﻿<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>

<link rel="stylesheet" type="text/css" href="/bitrix/themes/.default/adminstyles.css">

<?require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/templates/.default/filter_tools.php");?>
<? echo BeginFilterMy($arResult["SECTION"], $arResult["FILTER_NAME"], true); ?>

<? // вывод фильтра ?>
<form name="form1" method="POST" action="<?echo $APPLICATION->GetCurPage()?>">
    <tr valign="center">
	<td align="right" style="border-left:solid 1px white;border-top:solid 1px white;" nowrap="">Период (DD.MM.YYYY):</td>
	<td style="border-top:solid 1px white;border-right:solid 1px white;" nowrap="">
            <select name="find_date1_DAYS_TO_BACK" id="find_date1_DAYS_TO_BACK" onchange="jsAdminCalendar.InsertDaysBack(this.form.find_date1, this[this.selectedIndex].value);">
                <option value=""></option>
                <option <?= ($arResult["FILTER_DAYS_TO_BACK"]=="7")?"selected":""; ?> value="7">неделя</option>
                <option <?= ($arResult["FILTER_DAYS_TO_BACK"]=="30")?"selected":""; ?> value="30">месяц</option>
                <option <?= ($arResult["FILTER_DAYS_TO_BACK"]=="90")?"selected":""; ?> value="90">квартал</option>
                <option <?= ($arResult["FILTER_DAYS_TO_BACK"]=="365")?"selected":""; ?> value="365">год</option>
            </select>&nbsp;<span style="white-space:nowrap;"><input type="text" name="find_date1" id="find_date1" size="10" value="<?= $arResult["FILTER_FIND_DATE1"]; ?>">
            <script type="text/javascript" src="/bitrix/js/main/calendar.js?1359554119"></script>
            <? if ($arResult["FILTER_DAYS_TO_BACK"]>0): ?>
            <script>jsAdminCalendar.InsertDaysBack(document.getElementById("find_date1"), document.getElementById("find_date1_DAYS_TO_BACK").value);</script>
            <? endif; ?>
            <script>
                    var mess = {
                            'css_ver': '1359554119',
                            'title': 'Календарь',
                            'date': 'Вставить дату',
                            'jan': 'Январь',
                            'feb': 'Февраль',
                            'mar': 'Март',
                            'apr': 'Апрель',
                            'may': 'Май',
                            'jun': 'Июнь',
                            'jul': 'Июль',
                            'aug': 'Август',
                            'sep': 'Сентябрь',
                            'okt': 'Октябрь',
                            'nov': 'Ноябрь',
                            'des': 'Декабрь',
                            'prev_mon': 'Предыдущий месяц',
                            'next_mon': 'Следующий месяц',
                            'curr': 'Перейти на текущий месяц',
                            'curr_day': 'Вставить текущую дату',
                            'mo': 'Пн',
                            'tu': 'Вт',
                            'we': 'Ср',
                            'th': 'Чт',
                            'fr': 'Пт',
                            'sa': 'Сб',
                            'su': 'Вс',
                            'per_week': 'Период: неделя',
                            'per_mon': 'Период: месяц',
                            'per_year': 'Период: год',
                            'close': 'Закрыть',
                            'month': 'Выбрать месяц',
                            'year': 'Выбрать год',
                            'time': 'Показать время',
                            'time_hide': 'Скрыть время',
                            'hour': 'ч:',
                            'minute': 'м:',
                            'second': 'с:',
                            'hour_title': 'Часы (00 - 23)',
                            'minute_title': 'Минуты (00 - 59)',
                            'second_title': 'Секунды (00 - 59)',
                            'set_time': 'Установить текущее время (серверное)',
                            'clear_time': 'Сбросить время'
                    };

                    if (top.jsAdminCalendar)
                            top.jsAdminCalendar.mess = mess;
                    else
                            window.jsAdminCalendar.mess = mess;
            </script><a href="javascript:void(0);" title="Календарь"><img src="/bitrix/themes/.default/images/calendar/icon.gif" alt="Календарь" class="calendar-icon" onclick="jsAdminCalendar.Show(this, 'find_date1', 'find_date1', 'find_date2', false, 1394108465);" onmouseover="this.className+=' calendar-icon-hover';" onmouseout="this.className = this.className.replace(/\s*calendar-icon-hover/ig, '');"></a>...&nbsp;<input type="text" name="find_date2" size="10" value="<?= $arResult["FILTER_FIND_DATE2"]; ?>"><a href="javascript:void(0);" title="Календарь"><img src="/bitrix/themes/.default/images/calendar/icon.gif" alt="Календарь" class="calendar-icon" onclick="jsAdminCalendar.Show(this, 'find_date2', 'find_date1', 'find_date2', false, 1394108465);" onmouseover="this.className+=' calendar-icon-hover';" onmouseout="this.className = this.className.replace(/\s*calendar-icon-hover/ig, '');"></a></span>
        </td>
    </tr>
    <tr>
        <td valign="center" colspan="2" nowrap style="border:solid 1px white;">
            <input type="submit" class="button" name="set_filter" value="Установить">
            <input type="submit" class="button" name="del_filter" value="Сбросить">
            <input type="hidden" name="lang" value="<?echo LANG?>">
            <input type="hidden" name="filter" value="Y">
        </td>
    </tr>
</form>
<? echo EndFilterMy(); ?>
<div class="spacer h20"></div>    
<? if (strlen($arResult["FILTER_ERROR"])): ?>
<div class="filter_error"><?= $arResult["FILTER_ERROR"]; ?></div>    
<div class="spacer h20"></div>    
<? endif; ?>

<table border="0" cellspacing="1" cellpadding="0" class="requests">    
    
        <th>Ответственный</th>
        <th class="lamp"><div class="lamp-red" title="последний раз в обращение писал клиент техподдержки"></div></th>
        <th class="lamp"><div class="lamp-green" title="последний раз в обращение писал сотрудник техподдержки"></div></th>
        <th class="lamp"><div class="lamp-grey" title="обращение закрыто"></div></th>
        <th class="open">Открыто</th>
        <th class="all">Всего</th>
    </tr>
    <? foreach ($arResult["PERFORMERS"] as $user): ?>
    <tr>
        <td><?= $user["LAST_NAME"]." ".$user["NAME"]; ?></td>
        <td><?= $arResult["DATA"]["responsibility"][$user["ID"]]["red"]; ?></td>
        <td><?= $arResult["DATA"]["responsibility"][$user["ID"]]["green"]; ?></td>
        <td><?= $arResult["DATA"]["responsibility"][$user["ID"]]["closed"]; ?></td>
        <td><?= $arResult["DATA"]["responsibility"][$user["ID"]]["open"]; ?></td>
        <td><?= $arResult["DATA"]["responsibility"][$user["ID"]]["all"]; ?></td>
    </tr>
    <? endforeach; ?>
    <tr>
        <td>[не установлен]</td>
        <td><?= $arResult["DATA"]["responsibility"][""]["red"]; ?></td>
        <td><?= $arResult["DATA"]["responsibility"][""]["green"]; ?></td>
        <td><?= $arResult["DATA"]["responsibility"][""]["closed"]; ?></td>
        <td><?= $arResult["DATA"]["responsibility"][""]["open"]; ?></td>
        <td><?= $arResult["DATA"]["responsibility"][""]["all"]; ?></td>
    </tr>
    <tr>
        <td class="summ">Всего:</td>
        <td><?= $arResult["DATA"]["responsibility"]["all"]["red"]; ?></td>
        <td><?= $arResult["DATA"]["responsibility"]["all"]["green"]; ?></td>
        <td><?= $arResult["DATA"]["responsibility"]["all"]["closed"]; ?></td>
        <td><?= $arResult["DATA"]["responsibility"]["all"]["open"]; ?></td>
        <td><?= $arResult["DATA"]["responsibility"]["all"]["all"]; ?></td>
    </tr>    
</table>

<div class="spacer h20"></div>

<table border="0" cellspacing="1" cellpadding="0" class="requests">    
    <tr>
        <th>Категория</th>
        <th class="lamp"><div class="lamp-red"></div></th>
        <th class="lamp"><div class="lamp-green"></div></th>
        <th class="lamp"><div class="lamp-grey"></div></th>
        <th class="open">Открыто</th>
        <th class="all">Всего</th>
    </tr>
    <? foreach ($arResult["HANDBOOKS"]["CATEGORY"] as $item): ?>
    <tr>
        <td><?= $item["NAME"]; ?></td>
        <td><?= $arResult["DATA"]["category"][$item["ID"]]["red"]; ?></td>
        <td><?= $arResult["DATA"]["category"][$item["ID"]]["green"]; ?></td>
        <td><?= $arResult["DATA"]["category"][$item["ID"]]["closed"]; ?></td>
        <td><?= $arResult["DATA"]["category"][$item["ID"]]["open"]; ?></td>
        <td><?= $arResult["DATA"]["category"][$item["ID"]]["all"]; ?></td>
    </tr>
    <? endforeach; ?>
    <tr>
        <td>[не установлена]</td>
        <td><?= $arResult["DATA"]["category"][""]["red"]; ?></td>
        <td><?= $arResult["DATA"]["category"][""]["green"]; ?></td>
        <td><?= $arResult["DATA"]["category"][""]["closed"]; ?></td>
        <td><?= $arResult["DATA"]["category"][""]["open"]; ?></td>
        <td><?= $arResult["DATA"]["category"][""]["all"]; ?></td>
    </tr>
</table>

<div class="spacer h20"></div>

<?
if ($arParams["USE_PROJECT"]=="Y")
{
?>
<table border="0" cellspacing="1" cellpadding="0" class="requests">    
    <tr>
        <th>Проект</th>
        <th class="lamp"><div class="lamp-red"></div></th>
        <th class="lamp"><div class="lamp-green"></div></th>
        <th class="lamp"><div class="lamp-grey"></div></th>
        <th class="open">Открыто</th>
        <th class="all">Всего</th>
    </tr>
    <? foreach ($arResult["HANDBOOKS"]["PROJECT"] as $item): ?>
    <tr>
        <td><?= $item["NAME"]; ?></td>
        <td><?= $arResult["DATA"]["project"][$item["ID"]]["red"]; ?></td>
        <td><?= $arResult["DATA"]["project"][$item["ID"]]["green"]; ?></td>
        <td><?= $arResult["DATA"]["project"][$item["ID"]]["closed"]; ?></td>
        <td><?= $arResult["DATA"]["project"][$item["ID"]]["open"]; ?></td>
        <td><?= $arResult["DATA"]["project"][$item["ID"]]["all"]; ?></td>
    </tr>
    <? endforeach; ?>
    <tr>
        <td>[не установлен]</td>
        <td><?= $arResult["DATA"]["project"][""]["red"]; ?></td>
        <td><?= $arResult["DATA"]["project"][""]["green"]; ?></td>
        <td><?= $arResult["DATA"]["project"][""]["closed"]; ?></td>
        <td><?= $arResult["DATA"]["project"][""]["open"]; ?></td>
        <td><?= $arResult["DATA"]["project"][""]["all"]; ?></td>
    </tr>    
</table>

<div class="spacer h20"></div>
<?
}
?>
        
<table border="0" cellspacing="1" cellpadding="0" class="requests">    
    <tr>
        <th>Статус</th>
        <th class="lamp"><div class="lamp-red"></div></th>
        <th class="lamp"><div class="lamp-green"></div></th>
        <th class="lamp"><div class="lamp-grey"></div></th>
        <th class="open">Открыто</th>
        <th class="all">Всего</th>
    </tr>
    <? foreach ($arResult["HANDBOOKS"]["STATUSES"] as $item): ?>
    <tr>
        <td><?= $item["NAME"]; ?></td>
        <td><?= $arResult["DATA"]["status"][$item["ID"]]["red"]; ?></td>
        <td><?= $arResult["DATA"]["status"][$item["ID"]]["green"]; ?></td>
        <td><?= $arResult["DATA"]["status"][$item["ID"]]["closed"]; ?></td>
        <td><?= $arResult["DATA"]["status"][$item["ID"]]["open"]; ?></td>
        <td><?= $arResult["DATA"]["status"][$item["ID"]]["all"]; ?></td>
    </tr>
    <? endforeach; ?>
    <tr>
        <td>[не установлен]</td>
        <td><?= $arResult["DATA"]["status"][""]["red"]; ?></td>
        <td><?= $arResult["DATA"]["status"][""]["green"]; ?></td>
        <td><?= $arResult["DATA"]["status"][""]["closed"]; ?></td>
        <td><?= $arResult["DATA"]["status"][""]["open"]; ?></td>
        <td><?= $arResult["DATA"]["status"][""]["all"]; ?></td>
    </tr>      
</table>

<div class="spacer h20"></div>

<table border="0" cellspacing="1" cellpadding="0" class="requests">    
    <tr>
        <th>Критичность</th>
        <th class="lamp"><div class="lamp-red"></div></th>
        <th class="lamp"><div class="lamp-green"></div></th>
        <th class="lamp"><div class="lamp-grey"></div></th>
        <th class="open">Открыто</th>
        <th class="all">Всего</th>
    </tr>
    <? foreach ($arResult["HANDBOOKS"]["CRITICALITY"] as $item): ?>
    <tr>
        <td><?= $item["NAME"]; ?></td>
        <td><?= $arResult["DATA"]["criticality"][$item["ID"]]["red"]; ?></td>
        <td><?= $arResult["DATA"]["criticality"][$item["ID"]]["green"]; ?></td>
        <td><?= $arResult["DATA"]["criticality"][$item["ID"]]["closed"]; ?></td>
        <td><?= $arResult["DATA"]["criticality"][$item["ID"]]["open"]; ?></td>
        <td><?= $arResult["DATA"]["criticality"][$item["ID"]]["all"]; ?></td>
    </tr>
    <? endforeach; ?>
    <tr>
        <td>[не установлена]</td>
        <td><?= $arResult["DATA"]["criticality"][""]["red"]; ?></td>
        <td><?= $arResult["DATA"]["criticality"][""]["green"]; ?></td>
        <td><?= $arResult["DATA"]["criticality"][""]["closed"]; ?></td>
        <td><?= $arResult["DATA"]["criticality"][""]["open"]; ?></td>
        <td><?= $arResult["DATA"]["criticality"][""]["all"]; ?></td>
    </tr>          
</table>

<div class="spacer h20"></div>

<table border="0" cellspacing="1" cellpadding="0" class="requests">    
    <tr>
        <th>Оценка ответов</th>
        <th class="lamp"><div class="lamp-red"></div></th>
        <th class="lamp"><div class="lamp-green"></div></th>
        <th class="lamp"><div class="lamp-grey"></div></th>
        <th class="open">Открыто</th>
        <th class="all">Всего</th>
    </tr>
    <? foreach ($arResult["HANDBOOKS"]["MARK"] as $item): ?>
    <tr>
        <td><?= $item["NAME"]; ?></td>
        <td><?= $arResult["DATA"]["mark"][$item["ID"]]["red"]; ?></td>
        <td><?= $arResult["DATA"]["mark"][$item["ID"]]["green"]; ?></td>
        <td><?= $arResult["DATA"]["mark"][$item["ID"]]["closed"]; ?></td>
        <td><?= $arResult["DATA"]["mark"][$item["ID"]]["open"]; ?></td>
        <td><?= $arResult["DATA"]["mark"][$item["ID"]]["all"]; ?></td>
    </tr>
    <? endforeach; ?>
    <tr>
        <td>[не установлена]</td>
        <td><?= $arResult["DATA"]["mark"][""]["red"]; ?></td>
        <td><?= $arResult["DATA"]["mark"][""]["green"]; ?></td>
        <td><?= $arResult["DATA"]["mark"][""]["closed"]; ?></td>
        <td><?= $arResult["DATA"]["mark"][""]["open"]; ?></td>
        <td><?= $arResult["DATA"]["mark"][""]["all"]; ?></td>
    </tr>          
</table>

<div class="notes">
    <table cellspacing="0" cellpadding="0" border="0" class="notes">
        <tr class="top">
            <td class="left"><div class="empty"></div></td>
            <td><div class="empty"></div></td>
            <td class="right"><div class="empty"></div></td>
	</tr>
	<tr>
            <td class="left"><div class="empty"></div></td>
            <td class="content">
                <table border="0" cellspacing="6" cellpadding="0">
                    <tr>
        		<td valign="center" nowrap=""><div class="lamp-red"></div></td>
                	<td valign="center" nowrap="">последний раз в обращение писал клиент техподдержки</td>
                    </tr>
                    <tr>
                        <td valign="center" nowrap=""><div class="lamp-green"></div></td>
                        <td valign="center" nowrap="">последний раз в обращение писал сотрудник техподдержки</td>
                    </tr>
                    <tr>
                        <td valign="center" nowrap=""><div class="lamp-grey"></div></td>
                        <td valign="center" nowrap="">обращение закрыто</td>
                    </tr>
                </table>
            </td>
            <td class="right"><div class="empty"></div></td>
	</tr>
	<tr class="bottom">
            <td class="left"><div class="empty"></div></td>
            <td><div class="empty"></div></td>
            <td class="right"><div class="empty"></div></td>
	</tr>
    </table>
</div>